<%@page import="javafx.scene.control.Alert"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>单用户追踪</title>
<%
	// 权限验证
	if(session.getAttribute("currentMemberShip")==null){
		response.sendRedirect("login.jsp");
		return;
	}
%>
<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/static/jquery-easyui-1.4.4/themes/default/easyui.css">
<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/static/jquery-easyui-1.4.4/themes/icon.css">
<script type="text/javascript" src="${pageContext.request.contextPath}/static/jquery-easyui-1.4.4/jquery.min.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/static/jquery-easyui-1.4.4/jquery.easyui.min.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/static/jquery-easyui-1.4.4/locale/easyui-lang-zh_CN.js"></script>
<script type="text/javascript">
    var page=0;
    var lasttime;
    var beginDate = new Date();

    function getCommonData() {
    	
    	var IMSI = '';
		var MSISDN = '';
		var CTCS_ID = '';
		if ($('#in1').searchbox('getName') == 'IMSI') {
			IMSI = $('#in1').searchbox('getValue');
		} else if ($('#in1').searchbox('getName') == 'MSISDN') {
			MSISDN = $('#in1').searchbox('getValue');
		} else if ($('#in1').searchbox('getName') == 'CTCS_ID') {
			CTCS_ID = $('#in1').searchbox('getValue');
		}
		
		var nowDate = new Date();
		console.log(nowDate.getTime());
		
		return {"startTime":beginDate.getTime(), "endTime":nowDate.getTime(), "search":'1', "increase":'1', "IMSI":IMSI, 
			"MSISDN":MSISDN, "CTCS_ID":CTCS_ID};
    }
    
    var timeInterval = null;
    
	function searchSingleUser(){
		
		if (timeInterval != null) {
			clearInterval(timeInterval);
		}
		
		page=1;
		
		var data = getCommonData();
		
		if (data.IMSI.length < 1 && data.MSISDN.length < 1 && data.CTCS_ID.length < 1) {
			$.messager.alert("系统提示", "IMSI、MSISDN、机车号需填一项");
			return;
		}
		
		sendData(data, page, '1');
		
		timeInterval = setInterval("searchSingleUser()", 30000);
	}
	
	function searchNext(){
		var size=$("#dg" ).datagrid("getPager" ).data("pagination" ).options.pageSize;
		var rows  = $('#dg').datagrid("getRows");  
		if(rows.length<size){
			$.messager.alert("系统提示","当前页已经是最后一页！");
			return;
		} else {
			lasttime=rows[rows.length-1].startTime;
		}
		
		var data = getCommonData();
		
		data.endTime = lasttime;
		page=page+1;
		
		sendData(data, page, '1');
	}
	
	function searchBack(){
		if(page==1){
			$.messager.alert("系统提示","当前页已经是第一页！");
			 return;
		}
		
		var data = getCommonData();
		
		var rowsbefore = $('#dg').datagrid("getRows"); 
		if(rowsbefore.length>0){
			data.startTime = rowsbefore[0].startTime;
		} else {
			data.startTime = lasttime;
		}
		
		page=page-1;
		
		sendData(data, page, '0');
	}
	
	function sendData(data, page, increase) {
		var currentpage="第 "+page+" 页";
		var p=$("#dg" ).datagrid("getPager" )
		$(p).pagination({ //设置分页页数
			displayMsg:currentpage
		});

		$("#dg").datagrid('load',{
			"startTime":data.startTime,
			"endTime":data.endTime,
			"search":'3',
			"increase":increase,
			"IMSI":data.IMSI,
			"MSISDN":data.MSISDN,
			"CTCS_ID":data.CTCS_ID
		});
	}
	
	function checkData(){
		var flag=$("#flag").val();
		if(flag==1){
			$.post("${pageContext.request.contextPath}/sdcch/exisPrimaryKey.do",{primaryKey:$("#primaryKey").val()},function(result){
				if(result.exist){
					 $.messager.alert("系统提示","该PrimaryKey已存在，请更换下！");
					 $("#primaryKey").focus();
				}else{
					save();
				}
			},"json");
		}else{
			save();
		}
	}
	
	function closeDialog(){
		 $("#dlg").dialog("close");
		 resetValue();
	}
	
	function postExcelFile(params, url) { //params是post请求需要的参数，url是请求url地址
	    var form = document.createElement("form");
	    form.style.display = 'none';
	    form.action = url;
	    form.method = "post";
	    document.body.appendChild(form);

	    for(var key in params){
	      var input = document.createElement("input");
	      input.type = "hidden";
	      input.name = key;
	      input.value = params[key];
	      form.appendChild(input);
	    }

	    form.submit();
	    form.remove();
	  }
	
	function exportSingleUserInCurrentPage(){
		var rows  = $('#dg').datagrid("getRows");  
		if (rows.length < 1) {
			$.messager.alert("系统提示", "请查询需要导出的数据");
			return;
		}
    	var params = {data:JSON.stringify(rows)};
    	postExcelFile(params, "${pageContext.request.contextPath}/singleUser/exportcurrentpage.do");
	}
	function exportByTemplateInCurrentPage(){
		var rows = $("#dg").datagrid("getRows");
		if(rows.length<=0){
			$.messager.alert("系统提示","请先查询出要导出的数据！");
			return;
		}
		var strIds=[];
		 for(var i=0;i<rows.length;i++){
			 strIds.push(rows[i].primaryKey);
		 }
		 var ids=strIds.join(",");
		 window.open('${pageContext.request.contextPath}/singleUser/exportByTemplate.do?ids='+ids+'');
	}
	
	function exportSingleUserInAllPages(){
		var data = getCommonData();
		
		window.open('${pageContext.request.contextPath}/singleUser/export.do?startTime='+data.startTime+'&endTime='+data.endTime+
				'&IMSI='+data.IMSI+'&MSISDN='+data.MSISDN+'&CTCS_ID='+data.CTCS_ID);
	}
	
	function exportByTemplateInAllPages(){
		 window.open('${pageContext.request.contextPath}/singleUser/exportByTemplate.do?ids='+null+'');
	}
	
	function openUploadFileDialog(){
		$("#dlg2").dialog('open').dialog('setTitle','批量导入数据');
	}
	
	function downloadTemplate(){
		window.open('template/sdcchExportTemplate.xls');
	}
	
	function uploadFile(){
		$("#uploadForm").form("submit",{
			success:function(result){
				var result=eval('('+result+')');
				if(result.errorMsg){
					$.messager.alert("系统提示",result.errorMsg);
				}else{
					$.messager.alert("系统提示","上传成功");
					$("#dlg2").dialog("close");
					$("#dg").datagrid("reload");
				}
			}
		});
	}

	function formatDatebox(value) {
		 	var datetimeType = "";
		    var date =new Date(parseInt(value));
		    datetimeType = date.getFullYear()+"-"+(date.getMonth()+1)+"-"+date.getDate()
		    +" "+date.getHours()+":"+date.getMinutes()+":"+date.getSeconds()+" "+date.getMilliseconds();
		    if(datetimeType != "NaN-NaN-NaN NaN:NaN:NaN NaN")
		        return datetimeType;
	}
	
	function formatRawMessage(value) {
		return JSON.stringify(value);
	}
	
	function formatDirection(value) {
		if(value==1){
			return "上行";
		}else if(value == 0){
			return "下行";
		}
	}
	
	function formatLogicChannel(value) {
		if(value==0){
			return "FrequencySpectrum";
		}else if(value==1){
			return "SDCCH";
		}else if(value==2){
			return "SACCH";
		}else if(value==3){
			return "TCH";
		}else if(value==4){
			return "SACCH_WITH_TCH";
		}else if(value==5){
			return "FACCH";
		}else if(value==7){
            return "BCCH";
        }
        else if(value==8){
            return "AGCH";
        }
		else return value;
	}
	
	function formatSubType(value) {
		if (value.indexOf('Message') == -1) return value;
		
		var message = value.substr(7,3).trim();
		
		var result = message;
		
		if (message == '129') {
			result = 'M' + message +  ': ' + 'Validated Train Data';
		} else if (message == '130') {
			result = 'M' + message +  ': ' + 'Request for Shunting';
		} else if (message == '132') {
			result = 'M' + message +  ': ' + 'MA Request';
		} else if (message == '136') {
			result = 'M' + message +  ': ' + 'Train Position Report';
		} else if (message == '137') {
			result = 'M' + message +  ': ' + 'Request to stop earlier is granted';
		} else if (message == '138') {
			result = 'M' + message +  ': ' + 'Request to stop earlier is rejected';
		} else if (message == '146') {
			result = 'M' + message +  ': ' + 'Acknowledgement';
		} else if (message == '147') {
			result = 'M' + message +  ': ' + 'Acknowledgement of Emergency Stop';
		} else if (message == '149') {
			result = 'M' + message +  ': ' + 'Track Ahead Free Granted';
		} else if (message == '150') {
			result = 'M' + message +  ': ' + 'End of Mission';
		} else if (message == '153') {
			result = 'M' + message +  ': ' + 'Radio in-fill request';
		} else if (message == '154') {
			result = 'M' + message +  ': ' + 'No compatible version';
		} else if (message == '155') {
			result = 'M' + message +  ': ' + 'Initiation of a communication session';
		} else if (message == '156') {
			result = 'M' + message +  ': ' + 'Termination of a communication session';
		} else if (message == '157') {
			result = 'M' + message +  ': ' + 'SoM Position Report';
		} else if (message == '159') {
			result = 'M' + message +  ': ' + 'Session Established';
		} else if (message == '2') {
			result = 'M' + message +  ': ' + 'SR Authorisation';
		} else if (message == '3') {
			result = 'M' + message +  ': ' + 'Movement Authority';
		} else if (message == '6') {
			result = 'M' + message +  ': ' + 'Recognition of exit from TRIP mode';
		} else if (message == '8') {
			result = 'M' + message +  ': ' + 'Acknowledgement of Train Data';
		} else if (message == '9') {
			result = 'M' + message +  ': ' + 'Request to Stop Earlier';
		} else if (message == '15') {
			result = 'M' + message +  ': ' + 'Conditional Emergency Stop';
		} else if (message == '16') {
			result = 'M' + message +  ': ' + 'Unconditional Emergency Stop';
		} else if (message == '18') {
			result = 'M' + message +  ': ' + 'Revocation of Emergency Stop';
		} else if (message == '24') {
			result = 'M' + message +  ': ' + 'General message';
		} else if (message == '27') {
			result = 'M' + message +  ': ' + 'SH Refused';
		} else if (message == '28') {
			result = 'M' + message +  ': ' + 'SH Authorised';
		} else if (message == '33') {
			result = 'M' + message +  ': ' + 'MA with Shifted Location Reference';
		} else if (message == '34') {
			result = 'M' + message +  ': ' + 'Track Ahead Free Request';
		} else if (message == '37') {
			result = 'M' + message +  ': ' + 'In-fill MA';
		} else if (message == '40') {
			result = 'M' + message +  ': ' + 'Train outside controlled area';
		} else if (message == '32') {
			result = 'M' + message +  ': ' + 'Configuration Determination';
		} else if (message == '38') {
			result = 'M' + message +  ': ' + 'Initiation of a communication session';
		} else if (message == '39') {
			result = 'M' + message +  ': ' + 'Acknowledgement of termination of a communication session';
		} else if (message == '41') {
			result = 'M' + message +  ': ' + 'Train Accepted';
		} else if (message == '43') {
			result = 'M' + message +  ': ' + 'SoM position report confirmed by RBC';
		} else if (message == '45') {
			result = 'M' + message +  ': ' + 'Assignment of coordinate system';
		}
		
		return result;
	}
	
	//重写分页
	$(function(){
		
		
		$('#dg').datagrid({
			remoteSort:false,
	    }); 
		
		var p = $('#dg').datagrid('getPager');
		
	    $(p).pagination({ //设置分页功能栏
	    	
	    	//分页功能可以通过Pagination的事件调用后台分页功能来实现
            //layout:['prev','next'],
			layout:['list','sep'],
            /* beforePageText: '第',//页数文本框前显示的汉字 
            afterPageText: '页', */
            displayMsg:"",   
            buttons:[{iconCls:'icon-undo', handler:function(){
    				searchSingleUser();
    			}
    		},{iconCls:'icon-back', handler:function(){
    				searchBack();
    			}
    		}, {iconCls:'icon-next', handler:function(){
    				searchNext();
    		}}]
	    });
	    
	    $('#district').combotree({
	    	url: '${pageContext.request.contextPath}/sdcch/sdcchDistrictComboList.do'
	    });
	});
	
	formatterDate = function (date) {
		var day = date.getDate();
		var month = (date.getMonth() + 1);
		var hor = date.getHours();
		var min = date.getMinutes();
		var sec = date.getSeconds();
		return date.getFullYear() + '-' + month + '-' + day+" "+hor+":"+min+":"+sec;
	};

	$(function(){
		$('#i1').datetimebox('setValue', formatterDate(new Date(new Date(new Date().toLocaleDateString()).getTime())));
		$('#i2').datetimebox('setValue', formatterDate(new Date()));
	
		$('.searchbox-button').remove();
	});
	
	function formatKilometer(value) {
//		if (value.length <= 0) return; 
//		var start = value.substring(0, 4);
//		var end = value.substring(4, 7);
//		return 'k' + start + '+' + end;
		if(value.length > 3) {
			var start = value.substring(0,value.length-3);
			var end = value.substring(value.length-3, value.length);
			return 'k' + start + '+' + end;
		}
		else return value;
	}
	function timeSort(a, b){
		return a > b ? 1 : -1; 
	}
</script>
</head>
<body style="margin: 1px">
<table id="dg" title="单用户追踪" class="easyui-datagrid" fitColumns="fasle" pagination="true" rownumbers="true" pageSize="200" pageList="[200,400,600]"
   url="${pageContext.request.contextPath}/singleUser/list.do" fit="true" toolbar="#tb">
   <thead>
   	<tr>
   		<th field="cb" checkbox="true" align="center"></th>
   		<th field="startTime" width="140" align="center" formatter="formatDatebox" sortable="true" sorter="timeSort">触发时间</th>
   		<th field="IMSI" width="120" align="center">IMSI</th>
   		<th field="MSISDN" width="100" align="center">MSISDN</th>
   		<!-- <th field="trainNumber" width="80" align="center">车次号</th> -->
   		<th field="CTCS_ID" width="80" align="center">机车号</th>
   		<th field="siteName" width="80" align="center">小区名号</th>
   		<th field="direction" width="80" align="center" formatter="formatDirection">方向</th>
   		<th field="logicChannel" width="120" align="center" formatter="formatLogicChannel">信令类型</th>
   		<th field="subType" width="110" align="center" formatter="formatSubType">子类型</th>
   		<th field="CRCTest" width="80" align="center">CRC校验</th>
   		<th field="kilometer" width="90" align="center" formatter="formatKilometer">公里标</th>
   		<th field="speed" width="80" align="center">速度（km/h）</th>
   		<th field="dataLength" width="80" align="center">数据长度</th>
		<th field="LEVEL" width="100" align="center">LEVEL</th>
		<th field="SNR" width="120" align="center">SNR(dB)</th>
		<th field="QUALITY" width="100" align="center">QUALITY</th>
   		<th field="data" width="400" align="center">数据内容</th>
   		<th field="recordId" width="80" align="center">记录号</th>
   	</tr>
   </thead>
 </table>
 <div id="tb">
 	<div style="margin-top:4px; margin-left:7px">
 		<a href="javascript:exportSingleUserInCurrentPage()" class="easyui-linkbutton" iconCls="icon-save" plain="true">导出当前页单用户查询数据</a>
 		<a href="javascript:exportSingleUserInAllPages()" class="easyui-linkbutton" iconCls="icon-save" plain="true">导出所有页单用户查询数据</a>
 	</div>
 	<div style="margin-top:5px; margin-bottom:7px">
 		
 		&nbsp;&nbsp;
 		<input id="in1" class="easyui-searchbox" data-options="prompt:'Please Input Value',menu:'#mm'" style="width:300px; margin-top:10px"></input>
		<div id="mm">
			<div data-options="name:'IMSI'">IMSI</div>
			<div data-options="name:'MSISDN'">MSISDN</div>
			<div data-options="name:'CTCS_ID'">机车号</div>
		</div>
 		
 		<a href="javascript:searchSingleUser()" class="easyui-linkbutton" iconCls="icon-search" plain="true"><b style="font-size:15px">查询</b></a>
 		
 	</div>
 </div>
 
 <div id="dlg" class="easyui-dialog" style="width:620px;height:250px;padding: 10px 20px"
   closed="true" buttons="#dlg-buttons">
   
   <form id="fm" method="post">
   	<table cellspacing="8px">
   		<tr>
   			<td>primaryKey：</td>
   			<td><input type="text" id="primaryKey" name="primaryKey" class="easyui-validatebox" required="true"/></td>
   			<td>&nbsp;&nbsp;&nbsp;&nbsp;</td>
   			<td>timeStamp：</td>
   			<td><input type="text" id="timeStamp" name="timeStamp" class="easyui-validatebox" required="true"/></td>
   		</tr>
   		<tr>
   			<td>startTime：</td>
   			<td><input type="text" id="startTime" name="startTime" class="easyui-validatebox" required="true"/></td>
   			<td>&nbsp;&nbsp;&nbsp;&nbsp;</td>
   			<td>frontProcessorId：</td>
   			<td><input type="text" id="frontProcessorId" name="frontProcessorId" class="easyui-validatebox" required="true"/></td>
   		</tr>
   		<tr>
   			<td>recordId：</td>
   			<td><input type="text" id="recordId" name="recordId" class="easyui-validatebox" required="true"/></td>
   			<td>&nbsp;&nbsp;&nbsp;&nbsp;</td>
   			<td>IMSI：</td>
   			<td><input type="text" id="IMSI" name="IMSI" class="easyui-validatebox" required="true"/></td>
   		</tr>
   		<tr>
   			<td>logicChannel：</td>
   			<td><input type="text" id="logicChannel" name="logicChannel" class="easyui-validatebox" required="true"/></td>
   			<td>&nbsp;&nbsp;&nbsp;&nbsp;</td>
   			<td>MSISDN：</td>
   			<td><input type="text" id="MSISDN" name="MSISDN" class="easyui-validatebox" required="true"/></td>
   		</tr>
   		<tr>
   			<td>direction：</td>
   			<td><input type="text" id="direction" name="direction" class="easyui-validatebox" required="true"/></td>
   			<td>&nbsp;&nbsp;&nbsp;&nbsp;</td>
   			<td>frameNumber：</td>
   			<td><input type="text" id="frameNumber" name="frameNumber" class="easyui-validatebox" required="true"/></td>
   		</tr>
   		<tr>
   			<td>siteName：</td>
   			<td><input type="text" id="siteName" name="siteName" class="easyui-validatebox" required="true"/></td>
   			<td>&nbsp;&nbsp;&nbsp;&nbsp;</td>
   			<td>decode：</td>
   			<td><input type="text" id="decode" name="decode" class="easyui-validatebox" required="true"/></td>
   		</tr>

		<tr>
			<td>LEVEL：</td>
			<td><input type="text" id="LEVEL" name="LEVEL" class="easyui-validatebox" required="true"/></td>
			<td>&nbsp;&nbsp;&nbsp;&nbsp;</td>
			<td>SNR：</td>
			<td><input type="text" id="SNR" name="SNR" class="easyui-validatebox" required="true"/></td>
		</tr>
		<tr>
			<td>QUALITY：</td>
			<td><input type="text" id="QUALITY" name="QUALITY" class="easyui-validatebox" required="true"/></td>
			<td>&nbsp;&nbsp;&nbsp;&nbsp;</td>
		</tr>

   		<tr>
   			<td>rawMessage：</td>
   			<td><input type="text" id="rawMessage" name="rawMessage" class="easyui-validatebox" required="true"/></td>
   			<td>&nbsp;&nbsp;&nbsp;&nbsp;</td>
   			<td>BCCH：</td>
   			<td><input type="text" id="BCCH" name="BCCH" class="easyui-validatebox" required="true"/></td>
   		</tr>
   		<tr>
   			<td>layer：</td>
   			<td><input type="text" id="layer" name="layer" class="easyui-validatebox" required="true"/></td>
   			<td>&nbsp;&nbsp;&nbsp;&nbsp;</td>
   			<td>length：</td>
   			<td><input type="text" id="length" name="length" class="easyui-validatebox" required="true"/></td>
   		</tr>
   		<tr>
   			<td>data：</td>
   			<td><input type="text" id="data" name="data" class="easyui-validatebox" required="true"/></td>
   			<td>&nbsp;&nbsp;&nbsp;&nbsp;</td>
   			<td>kilometer：</td>
   			<td><input type="text" id="kilometer" name="kilometer" class="easyui-validatebox" required="true"/></td>
   		</tr>
   		<tr>
   			<td>speed：</td>
   			<td><input type="text" id="speed" name="speed" class="easyui-validatebox" required="true"/></td>
   			<td>&nbsp;&nbsp;&nbsp;&nbsp;</td>
   			<td>CI：</td>
   			<td><input type="text" id="CI" name="CI" class="easyui-validatebox" required="true"/></td>
   		</tr>
   		<tr>
   			<td>LAC：</td>
   			<td><input type="text" id="LAC" name="LAC" class="easyui-validatebox" required="true"/></td>
   			<td>&nbsp;&nbsp;&nbsp;&nbsp;</td>
   			<td>CTCS_ID：</td>
   			<td><input type="text" id="CTCS_ID" name="CTCS_ID" class="easyui-validatebox" required="true"/></td>
   		</tr>
   		<tr>
   			<td>ENGINE_ID：</td>
   			<td><input type="text" id="ENGINE_ID" name="ENGINE_ID" class="easyui-validatebox" required="true"/></td>
   			<td>&nbsp;&nbsp;&nbsp;&nbsp;</td>
   			<td>MS_TYPE：</td>
   			<td><input type="text" id="MS_TYPE" name="MS_TYPE" class="easyui-validatebox" required="true"/></td>
   		</tr>
   		<tr>
   			<td>message_TYPE：</td>
   			<td><input type="text" id="message_TYPE" name="message_TYPE" class="easyui-validatebox" required="true"/></td>
   			<td>&nbsp;&nbsp;&nbsp;&nbsp;</td>
   			<td>sourceData：</td>
   			<td><input type="text" id="sourceData" name="sourceData" class="easyui-validatebox" required="true"/></td>
   		</tr>
   		<tr>
   			<td>ARFCN：</td>
   			<td><input type="text" id="ARFCN" name="ARFCN" class="easyui-validatebox" required="true"/></td>
   			<td>&nbsp;&nbsp;&nbsp;&nbsp;</td>
   			<td>RA：</td>
   			<td><input type="text" id="RA" name="RA" class="easyui-validatebox" required="true"/></td>
   		</tr>
   		<tr>
   			<td>RF_Capability：</td>
   			<td><input type="text" id="RF_Capability" name="RF_Capability" class="easyui-validatebox" required="true"/></td>
   			<td>&nbsp;&nbsp;&nbsp;&nbsp;</td>
   			<td>TMSI_IMSI：</td>
   			<td><input type="text" id="TMSI_IMSI" name="TMSI_IMSI" class="easyui-validatebox" required="true"/></td>
   		</tr>
   		<tr>
   			<td>call_BCD_Num：</td>
   			<td><input type="text" id="call_BCD_Num" name="call_BCD_Num" class="easyui-validatebox" required="true"/></td>
   			<td>&nbsp;&nbsp;&nbsp;&nbsp;</td>
   			<td>LU_Type：</td>
   			<td><input type="text" id="LU_Type" name="LU_Type" class="easyui-validatebox" required="true"/></td>
   		</tr>
   		<tr>
   			<td>timeSlot：</td>
   			<td><input type="text" id="timeSlot" name="timeSlot" class="easyui-validatebox" required="true"/></td>
   			<td>&nbsp;&nbsp;&nbsp;&nbsp;</td>
   			<td>TMSI：</td>
   			<td><input type="text" id="TMSI" name="TMSI" class="easyui-validatebox" required="true"/></td>
   		</tr>
   		<tr>
   			<td>channel：</td>
   			<td><input type="text" id="channel" name="channel" class="easyui-validatebox" required="true"/></td>
   			<td>&nbsp;&nbsp;&nbsp;&nbsp;</td>
   			<td>TCH：</td>
   			<td><input type="text" id="TCH" name="TCH" class="easyui-validatebox" required="true"/></td>
   		</tr>
   		<tr>
   			<td>IMEI：</td>
   			<td><input type="text" id="IMEI" name="IMEI" class="easyui-validatebox" required="true"/></td>
   			<td>&nbsp;&nbsp;&nbsp;&nbsp;</td>
   			<td>l2：</td>
   			<td>
   			<input type="text" id="l2" name="l2" class="easyui-validatebox" required="true"/>
   			<input type="hidden" id="flag" name="flag"/>
   			</td>
   		</tr>
   	</table>
   </form>
 </div>
 
 <div id="dlg-buttons">
 	<a href="javascript:checkData()" class="easyui-linkbutton" iconCls="icon-ok">保存</a>
 	<a href="javascript:closeDialog()" class="easyui-linkbutton" iconCls="icon-cancel">关闭</a>
 </div>
 
 <div id="dlg2" class="easyui-dialog" style="width:400px;height:180px;padding:10px 20px"
            closed="true" buttons="#dlg-buttons2">
        <form id="uploadForm" action="${pageContext.request.contextPath}/sdcch/upload.do" method="post" enctype="multipart/form-data">
        	<table>
        		<tr>
        			<td>下载模版：</td>
        			<td><a href="javascript:void(0)" class="easyui-linkbutton"  onclick="downloadTemplate()">导入模版</a></td>
        		</tr>
        		<tr>
        			<td>上传文件：</td>
        			<td><input type="file" name="sdcchUploadFile"></td>
        		</tr>
        	</table>
        </form>
	</div>
    
	<div id="dlg-buttons2">
		<a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-ok" onclick="uploadFile()">上传</a>
		<a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-cancel" onclick="javascript:$('#dlg2').dialog('close')">关闭</a>
	</div>
	
	
</body>
</html>